﻿using System.Data;
using MigSharp;

namespace CmsDatabaseMigrations.Migrations
{
    [MigrationExport(Tag = "Adds ParentMediaId field to Media table. Needed for sub-folders.", ModuleName = "Media")]
    public class MediaAddParent201206261200 : IReversibleMigration
    {
        private const string NewColumnName = "ParentMediaId";

        public void Up(IDatabase db)
        {
            db.Tables["Media"].AddNullableColumn(NewColumnName, DbType.Int32);            
        }

        public void Down(IDatabase db)
        {
            db.Tables["Media"].Columns[NewColumnName].Drop();            
        }
    }
}